﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WS.EKA.FJYCM.Business.Model;
using System.Data;
using WS.EKA.FJYCM.Utilities;
using Oracle.DataAccess.Client;
using WS.EKA.FJYCM.Business.DAL;

namespace WS.EKA.FJYCM.Business
{
    public class SystemAccess
    {
        static IDB db_Aradmin = DBFactory.CreateARDB();
        static IDB db_Padmin = DBFactory.CreatePDB();

        public static List<AppSystems> GetSystems()
        {
            DataTable table = db_Aradmin.ExecuteDataTable(
                "select Category,Type,AppSystemName,BusinessType from ast_bmc_appsystem");
            return table.ToList<AppSystems>();
        }
        //get systems by security level
        public static List<AppSystems> GetSystemsByLevel(string securityLevel)
        {
            var parameter = new OracleParameter("SecurityLevel", securityLevel);
            DataTable table = db_Aradmin.ExecuteDataTable(
                "select distinct Category,Type,AppSystemName,BusinessType from ast_bmc_appsystem" +
            " where category = '应用系统' and company = '福建省烟草专卖局' and securitylevel = :SecurityLevel", parameter);

            return table.ToList<AppSystems>();
        }

    }
}
